﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectBot.Managers
{
    public class ProjectManager
    {
        private static Dictionary<string, GoogleCodeProject> currentProjectList= new Dictionary<string,GoogleCodeProject>();
        public static Dictionary<string, GoogleCodeProject> CurrentProjectList
        {
            get { return currentProjectList; }
            set { value = currentProjectList; }
        }
        public static void AddLastKnownGoodProject(string projectname, GoogleCodeProject project)
        {
            GoogleCodeProject parse = null;
            currentProjectList.TryGetValue(projectname, out parse);
            if (parse != null) { return; } // Already in our list
            currentProjectList.Add(projectname, project);
        }
        public static void RemoveProject(string projectname)
        {
            GoogleCodeProject parse = null;
            currentProjectList.TryGetValue(projectname, out parse);
            if (parse == null) { return; } // We dont have this, dont worry about it
            // ok all good lets remove it
            currentProjectList.Remove(projectname);
        }
        public static bool IsContained(string projectName)
        {
            GoogleCodeProject parse = null;
            currentProjectList.TryGetValue(projectName, out parse);
            if (parse != null) { return true; }
            else { return false; }
        }
        public static GoogleCodeProject GetGoogleCodeproject(string projectName)
        {
            if (IsContained(projectName)) { return currentProjectList[projectName]; }
            else return null;
        }
    }
}
